package de.fuberlin.inf.alp3.ue04;

public class MapImplTest {
    public static void main(String[] args) {
        MapImpl<Integer, String> a = new MapImpl<Integer, String>();
        System.out.println("entering [1=>a, 2=>b, 3=>c, 4=>d]");
        a.enter(1, "a");
        a.enter(2, "b");
        a.enter(3, "c");
        a.enter(4, "d");
        
        System.out.print("a.getLength() delivers ");
        System.out.println(a.getLen());
        System.out.println("copying a to b");
        MapImpl<Integer, String> b = (MapImpl<Integer, String>) a.copy();
        System.out.print("b.getLength() delivers ");
        System.out.println(b.getLen());
        System.out.print("a.equals(b) delivers ");
        System.out.println(a.equals(b));
        System.out.print("a.lookup(1) delivers ");
        try {
            System.out.println(a.lookup(1));
        } catch (NotFound e) {
            e.printStackTrace();
        }
        System.out.println("replacing first and last");
        b.enter(1, "first");
        b.enter(4, "last");
        System.out.print("b.getLength() delivers ");
        System.out.println(b.getLen());
        System.out.print("b.lookup(1) delivers ");
        try {
            System.out.println(b.lookup(1));
        } catch (NotFound e) {
            e.printStackTrace();
        }
        System.out.print("a.equals(b) delivers ");
        System.out.println(a.equals(b));
    }
}
